1. Field of the Invention
The present invention relates to a signal processing device suitably applied to, for example, an electronic control unit for engines.
2. Description of the Related Art
In the field of engine control, various controls are executed by processing signals by software. For example, an input circuit equipped with an input capture function receives a pulse input signal from a crankshaft sensor attached to a crankshaft. The input circuit detects the edges and/or level of the pulse input signal. Then, a software process is carried out to measure the pulse interval and period. Another software process may be carried out in synchronism with the edges of the pulse input signal.
The input capture function is a specific function of detecting the occurrence of a valid edge and latching the time (timer value) when the valid edge occurs. In other words, the input capture function generates an interrupt signal in synchronism with the rising or falling edges of the signals and records the time of occurrence of the interrupt signal in collaboration with a timer. The input capture function makes it possible to accurately measure the pulse width and period and to execute an interrupt process in synchronism with the rising or falling edges of the signals. The input capture function is described in, for example, Japanese Patent Application Publication No. 2004-239772.
The software processing utilizing the above-mentioned input capture function is capable of determining whether the valid edge is a rising edge or a falling edge by reading the signal level of the valid edge immediately after this valid edge occurs.
There is a possibility that a time lag (time difference) may occur between the occurrence of the valid edge (at the time of the occurrence of the interrupt signal by hardware process) and the reading of the signal level by software process. Such a time lag may arise from various factors. For example, a time lag may occur when a higher-priority process is executed. Another new valid edge may occur between the hardware process and the subsequent software process. If another new edge occurs prior to reading the signal level, the signal level may be erroneously read. If the software process uses erroneous signal level information, error may take place.
Further, as shown in FIG. 1, a similar problem may occur in a case where the interrupt process is masked for a given time and this masking is then released. For example, engine control executes a sequence as shown in FIG. 1, in which the interrupt process is masked for a given period of time in order to eliminate noise that arises from activation of an engine starter. However, a problem as shown in FIG. 1 may occur. In FIG. 1, T1 denotes the time when a valid edge occurs. The valid edge occurrence time T1 is acquired by software and masking is then released. An interrupt process P1 by software reads the current signal level. However, the interrupt process P1 by software cannot make a decision as to whether the above read signal level is a past signal level prior to time T2 or a new signal level after time T2 when another new signal edge is available. Thus, the software process may use erroneous signal level information.